object ArrayTest{
	def main(args:Array[String]){
		var myList = Array(1.9,2.9,3.4,3.5)	
		
		//遍历数组
		for(x<-myList){
		  println(x)		
		}
		
		var sum = 0.0
		for(i<- 0 to (myList.length-1)){
		  sum += myList(i)		
		}
		println("sum="+sum);

		//查找最大元素
		var max = myList(0)
		for(i <- 1 to (myList.length-1)){
		  if(myList(i)>max)  max = myList(i);		
		}
		println("max="+max);
	}
}
